// jQuery.noConflict();
var variant;
var category_path;
window.addEvent('domready', function() {

	var catMenu = new MenuMatic({
		id : "categoriesTree",
		orientation : 'vertical',
		onInit_complete : function() {
			// $$('#nav a', '#subMenusContainer
			// a').addEvent('click',function(e){
			$$('#categoriesTree a').addEvent('click', function(e) {
				event.preventDefault();
				var link = e.target.getAttribute('href');
				category_path = link.substr(link.indexOf('=') + 1);
				//if (variant != null) {
					//link = link + "&variantId=" + variant;
				//}
				location.href = link;
				console.log("onCategoryClick " + link);
			});
		}
	});
	var modelMenu = new MenuMatic({
		id : "modelsTree",
		orientation : 'vertical',
		onInit_complete : function() {
			$$('#modelsTree a').addEvent('click', function(e) {
				event.preventDefault();
				var link = e.target.getAttribute('href');
				variant = link.substr(link.indexOf('=') + 1);
				//if (variant != null) {
					link = link + "&cpath=" + category_path;
				//}
				location.href = link;
				console.log("onModelClick " + link);
			});
		}
	});

});
